home *** CD-ROM | disk | FTP | other *** search
- Path: fred.net!news
- From: bitmask@bigdog.fred.net (Scott Allen)
- Newsgroups: comp.lang.c
- Subject: Re: STRTOL, STRTUL,STRTOD functions
- Date: Tue, 19 Mar 1996 15:34:36 GMT
- Organization: FredNet - Frederick, Md.
- Message-ID: <314ed2d3.110217@news.fred.net>
- References: <4ifjao$j5c@news1.h1.usa.pipeline.com>
- NNTP-Posting-Host: bitmask.fred.net
- X-Newsreader: Forte Agent .99d/32.168
-
- fredrics@usa.pipeline.com(Fredric Smith) wrote:
-
- >I cannot find sample pieces of code for these..would appreciate some
- >help..if someone can
- >
-
-
-
- int main(void)
- {
- char *string = "87654321", *endptr;
- long lnumber;
-
- /* strtol converts string to long integer */
- /* strtoul converts a string to an unsigned long */
- /* strtod converts a string to a double */
-
- /* *endptr will point to the character that stopped the scan */
-
-
- lnumber = strtol(string, &endptr, 10);
-
- printf("string = %s long = %ld\n", string, lnumber);
-
- return 0;
- }
-
-
- Hope this helps,
-
- --
- Scott Allen
- bitmask@bigdog.fred.net
- Hagerstown, MD USA
-